package com.example.tourism.controller;

import com.example.tourism.pojo.Result;
import com.example.tourism.service.HomeService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/home")
public class HomeController {

    @Autowired
    private HomeService homeService;

    @GetMapping("/recommends")
    public Result  getRecommend(){

        return homeService.getRecommendHotels();
    }
    @GetMapping("/hotelDetail")
    public Result getHotels(String id, HttpServletRequest request){
//        String userId= (String) request.getAttribute("Id");
        return  homeService.getHotelDetail(id);
    }

    @GetMapping("/roomList")
    public Result getRoomList(String hotelId){
//        String userId= (String) request.getAttribute("Id");
        return homeService.getRoomList(hotelId);
    }
}
